#include "binaryTree.h"
#include "queue.h"

BTNode* BuyBTNode(int x)
{
	BTNode* node = (BTNode*)malloc(sizeof(BTNode));
	if (node == NULL)
	{
		perror("malloc fail");
		exit(-1);
	}

	node->val = x;
	node->left = node->right = NULL;
	return node;
}

int
main()
{
  BTNode* n1 = BuyBTNode(1);
  BTNode* n2 = BuyBTNode(2);
  BTNode* n3 = BuyBTNode(3);
  BTNode* n4 = BuyBTNode(4);
  BTNode* n5 = BuyBTNode(5);
  BTNode* n6 = BuyBTNode(6);

  BTNode* n7 = BuyBTNode(7);
  n2->right = n7;

  n1->left = n2;
  n1->right = n4;
  n2->left = n3;
  n4->left = n5;
  n4->right = n6;

  LevelOrder(n1);

  return EXIT_SUCCESS;
}